Add HUD animation Lua API - #17295
Conversation
821c4fc to
ca8780a
Compare
|
Force-pushed because I was fixing just 3 tiny typos in the |
|
To be honest, I am a bit torn. On the one hand, this is definitely a cool feature! And you have done the work already. Something like the animation API in this PR can then be implemented in Lua, on the server, with no dependence on the client version - be it part of the engine or a mod. Of course there's the argument of "SSCSM won't be accessible to modders soon", but then there's the counterargument of "we should prioritize SSCSM over implementing features that SSCSM will facilitate greatly". |
|
@appgurueu Thanks for taking a look - I want to say that I don't think this PR and SSCSM are in conflict at all. Yes, SSCSM will eventually let you do raw client-side HUD pos manipulation, and that's great. But keyframe animation with built-in easing is still a useful feature - it means not every modder has to reimplement the interpolation math themselves. Even in a world where SSCSM exists and exposes The client-side animation system this PR adds is self-contained and just adds to available things that CSM mods in general could use. When SSCSM lands and gains HUD access, it can call into this exact same system. The keyframe engine is already there - SSCSM just becomes another way to drive it. The point about "we should prioritize SSCSM over implementing features that SSCSM will facilitate greatly" - I understand what you mean, but I'm not asking anyone to spend their time writing this feature over SSCSM - as you said, this work is already done, and as I said above, i think it actually adds and can help enchance CSM in general, whether SS or local. In short, this isn't an either/or, in my view it's a code that both gives current mods some more freedom, and future SSCSM mods another useful local API to access. |
|
On a different note: I am interested in helping out development, including SSCSM actually. I've done c++ in my professional programming career, though it was over 9yrs ago - I'm just not up to date on all latest c++ features, C++11 was the last standard i worked with - but that just means I'm behind on syntax, i still have a good understanding of how c++ works. So if SSCSM needs more help, or the new UI rework (as I already posted on matrix....before the spam that just happened) - I'm def interested in helping out. Edit: Actually as a first step, I can work on exposing HUD elements + the client-side animation API to current CSM - if that aligns with roadmap plans (otherwise no point in me spending time on it :)) |
|
Apart from whether it's better to implement this with SSCSM or not, also note that a formspec replacement is planned, which may also affect the HUD. #6527 |
|
Hey @cx384 I was actually already aware of the UI rework, rubenwardy mentioned it on Discord, and I mentioned that I am interested in helping out with that too. That said, if the rework is still early stages, and it's unclear whether it'll even touch HUD specifically, there's a point to be made about adding this. Either way my offer to help stands, happy to drop this PR and see if I can do something similar and beyond for UI rework. |
|
We can safely assume that the GUI/HUD rework has not been moving forward for months, @v-rob doesn't seem active |
|
Well if you want someone else to come in to help with the GUI/HUD rework, like I said, I'm interested and happy to follow specs or discuss and chip in ideas. |
ca8780a to
22a3fe3
Compare
|
Updated branch, rebased on latest master as there were conflicts. If you would really rather wait for SSCSM rather than providing this functionality now, let me know and close the PR! |
|
I have to say, having spent a bit of time getting to understand SSCSM a bit better, I think in their current state they're at least a year from initial usable release to server mods - and i think that's only possible if development is focused on them. The reality is that people are busy, there's other issues and improvements to make and things take time to discuss and agree upon. As for this not being discussed in an issue before - I wasn't sure what the best way to discuss this is, but given I had working code I thought this PR can serve as discussion. If an issue would reach more people, I can open one too, link this PR and use that for discussion. My personal opinion is that with the state of SSCSM - and that I really haven't seen anything concrete about the UI rework - I think there are definite benefits to merging this PR, It's fairly stand alone and its actual implementation can easily be moved to built-in CSMs later, without changing the existing API. |
22a3fe3 to
ef7ab85
Compare
ef7ab85 to
22a3fe3
Compare
|
My two cents: SSCSM is still a ways off and the new UI doesn't seem to be happening anytime soon. As a modder these are features that can be useful now. For example I3 would likely use this for it's notification api. Awards could benefit from it. So for me I'd much rather see this get added now, then put off until 2028 or 2029 when SSCSM's finally come out of experimental and a new GUI api gets under way. (Because why work on a new GUI when it may as well be done with SSCSM.) My point is this: The work is done, it'd be helpful and nice, so don't kick the can down the road! |
Goal of the PR:
Add smooth client-side keyframe animations for HUD elements via a new
player:hud_animate(id, def)Lua API, along with adding new opacity field for HUD elements that can also be animated.How does the PR work?
TOCLIENT_HUDANIMATEnetwork packet (0x65) that sends animation definitions from server to clientDoes it resolve any reported issue?
No.
Does this relate to a goal in the roadmap?
If not a bug fix, why is this PR needed? What usecases does it solve?
The only way to animate any hud element currently is continuous calls to pos/scale/etc, and it won't be smooth.
This PR enables smooth client-side animations defined once and interpolated per-frame. Use cases include:
LLM/AI disclosure:
To do
This PR is Ready for Review.
How to test
LUA mod code to test this
Video of above mod code running
Recording.2026-06-25.090330.mp4